<template>
  <div class="hello">
     {{$store.state.num}}
     <button @click="myince">异步</button>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: ''
    }
  },
  mounted(){
  //   let arr=play=>{
  //       return play
  //   }
  //  console.log( arr(10) ) 


  },
  methods:{
       myince(){
          //this.$store.commit('ince',20)// commit 直接提交到mutation 
         this.$store.dispatch('asyncince',20)// dispatch 是先提交到action->mutation->然后在改变
          //this.$store.dispatch('changeAfdd',20) //

       }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
